#!/usr/bin/env python

import wx
import resource.dimen as rDimen

class Form(wx.Panel):
    '''Form class
    
    @author Julot <andy.julot@gmail.com>
    @since Friday, April 13, 2012. 01:58 PM'''
    
    def __init__(self, parent):
        style = wx.BORDER_THEME | wx.TAB_TRAVERSAL
        super(Form, self).__init__(parent, style=style)
        
        spacer = rDimen.spacer
        sizer = wx.FlexGridSizer(cols=2, vgap=spacer, hgap=spacer)
        sizer.AddGrowableCol(1)
        sizer.AddGrowableRow(1)
        
        labelFlag = wx.ALIGN_CENTER_VERTICAL
        
        c = 'No'
        label = wx.StaticText(self, label='%s:' % c)
        sizer.Add(label, flag=labelFlag)
        
        self.code = wx.TextCtrl(self)
        sizer.Add(self.code, 0, wx.GROW)
        
        c = 'Synopsis'
        label = wx.StaticText(self, label='%s:' % c)
        sizer.Add(label, flag=wx.ALIGN_TOP)
        
        style = wx.TE_PROCESS_ENTER | wx.TE_MULTILINE
        self.synopsis = wx.TextCtrl(self, style=style)
        sizer.Add(self.synopsis, 0, wx.GROW)
        
        self.SetSizerAndFit(sizer)
    
    def disable(self):
        self.code.Disable()
        self.synopsis.Disable()
    
    def enable(self):
        self.code.Enable()
        self.synopsis.Enable()